﻿//Created by Action Script Viewer - http://www.buraks.com/asv
package Display.hud.components {
    import flash.display.*;
    import org.aswing.*;
    import Classes.*;
    import Display.*;
    import flash.text.*;
    import org.aswing.border.*;
    import Display.aswingui.*;
    import Engine.*;
    import Display.hud.*;

    public class HUDCoinsComponent extends HUDComponent {

        public var m_coinsText:JTextField;
        protected var m_coinsHolder:JPanel;
        private var m_coinAsset:DisplayObject;

        public function HUDCoinsComponent(_arg1:Function=null){
        }
        override protected function buildComponent():void{
            m_jPanel = ASwingHelper.makeSoftBoxJPanel(SoftBoxLayout.LEFT, 0);
            this.m_coinAsset = (new EmbeddedArt.hud_coinmeter() as DisplayObject);
            var _local1:TextFormat = new TextFormat(EmbeddedArt.DEFAULT_FONT_NAME_BOLD, 18, 0xFFFFFF, true, false, false, null, null, TextFormatAlign.RIGHT);
            var _local2:JPanel = ASwingHelper.makeSoftBoxJPanelVertical(SoftBoxLayout.CENTER);
            this.m_coinsHolder = ASwingHelper.makeSoftBoxJPanel(SoftBoxLayout.RIGHT);
            ASwingHelper.setSizedBackground(this.m_coinsHolder, this.m_coinAsset);
            this.m_coinsText = ASwingHelper.makeTextField("", EmbeddedArt.DEFAULT_FONT_NAME_BOLD, 16, EmbeddedArt.greenTextColor, 0, _local1);
            _local2.append(this.m_coinsHolder);
            this.m_coinsText.setBorder(new EmptyBorder(null, new Insets(DEFAULT_MARGIN_TOP, 0, 0, DEFAULT_MARGIN_RIGHT)));
            this.m_coinsHolder.appendAll(this.m_coinsText);
            _local2.append(this.m_coinsHolder);
            m_jPanel.append(_local2);
        }
        override protected function attachToolTip():void{
            m_toolTip = new ToolTip(function ():String{
                return (ZLoc.t("Main", "Gold_ToolTip", {coins:m_coinsText.getText()}));
            });
            m_toolTip.attachToolTip(this);
            m_toolTip.hideCursor = true;
        }
        override protected function setCounter():void{
            m_counter = new HUDCounter(function (_arg1:Number):void{
                m_coinsText.setText(Utilities.formatNumber(_arg1));
            });
        }

    }
}//package Display.hud.components 
